package com.china08.yxyapi.repository.mg.homework;

import java.util.Date;
import java.util.List;

import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;

import com.china08.yxyapi.entity.mg.homework.HomeworkClassForDayReport;

/**
 * 作业:知识点:学生 (每个一个学生的一个知识点 存储一条记录)
 */
public interface HomeworkClassForDayReportRepository extends MongoRepository<HomeworkClassForDayReport, String> {

    List<HomeworkClassForDayReport> findByClassIdIn(List<String> classIds);

    List<HomeworkClassForDayReport> findByClassId(String classId);

    @Query(value = "{'class_id' : ?0 ,'statis_date' : {$gte: ?1, $lte : ?2} ,'stage' : ?3}")
    List<HomeworkClassForDayReport> findByClassIdAndStatisDateGreaterThanEqualAndStatisDateLessThanEqual(String classId,
            Date beginDate, Date endDate, String stage);

    @Query(value = "{'class_id' : ?0 ,'subject' : ?1 ,'statis_date' : {$gte: ?2, $lte : ?3} ,'stage' : ?4}}")
    List<HomeworkClassForDayReport> findByClassIdAndSubjectAndStatisDateGreaterThanEqualAndStatisDateLessThanEqual(
            String classId, String subject, Date beginDate, Date endDate, String stage);

}
